@extends('admin.layout.index')
@section('content')
    @include('admin.layout.breadcrumb')
    <div class="wrapper wrapper-content animated fadeInRight" >
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>编辑</h5>
                    </div>
                    <div class="ibox-content">
                        <form id="form"  class="form-horizontal ng-pristine ng-valid" method="post" action="{{ asset('manager/edit') }}">
                            <input type="hidden" name="_token" value="{{ csrf_token() }}">
                            <input type="hidden" name="flag" value="1">
                            <input type="hidden" name="id" value="{{ $result['admin_group_member']->id }}">
                            <div class="form-group"><label class="col-md-2 control-label required-label">手机号</label>
                                <div class="col-md-5 col-lg-3"><input type="text" disabled="" placeholder="{{ $result['admin_group_member']->mobile }}" class="form-control"></div>
                            </div>                            
                            <div class="form-group"><label class="col-md-2 control-label required-label">分配角色</label>
                                <div class="col-md-5 col-lg-3">
                                    <select class="input-lg form-control input-s-sm inline required" name="group_id" id="group_id" >
                                        <option value="">--请选择--</option>
                                        @if (!empty(count($result['group_list'])))
                                        @foreach($result['group_list'] as $k => $v)
                                        <option value="{{ $v->group_id }}" @if ($v->group_id == $result['admin_group_member']->group_id) selected="selected" @endif >{{ $v->groupname }}</option>
                                        @endforeach
                                        @endif
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-primary" type="button" id="submitBtn">提交</button>
                                    <a class="btn btn-white" onclick="javascript:history.back()" href="JavaScript:void(0);">返回</a>
                                </div>
                            </div>
                            <!--
                            <div class="actions clearfix">
                                <ul role="menu" aria-label="Pagination">
                                    <li aria-hidden="false"><a href="#finish" role="menuitem">提交</a></li>
                                    <li><a class="btn btn-white" ng-click="javascript:history.back()">返回</a></li>                                                                                
                                </ul>
                            </div>
                            -->
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>


@endsection

@section('css')
<link href="{{ Config::get('website.storage_url') }}/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
@endsection

@section('js')
<!-- iCheck -->
<script src="{{ Config::get('website.storage_url') }}/admin/js/plugins/iCheck/icheck.min.js"></script>
<script src="{{ Config::get('website.storage_url') }}/admin/js/plugins/validate/jquery.validate.min.js"></script>
<script>
    $(document).ready(function(){
        $("#submitBtn").click(function(){
            if($("#form").valid()){
                $("#form").submit();
            }
        });
        
        $('#form').validate({
            errorPlacement: function (error, element)
            {
                element.before(error);
            },
            rules: {
            },
            messages : {
                group_id : {
                    required : "角色不能为空"
                }
            }
        });
        
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
    });
</script>
@endsection